import { getTypeDetail } from '@/api/basic'
import { ref } from 'vue'
import { AddOrUpdateNetworkTypeFrom } from '../types'

const useGetNetworkTypeDetail = () => {
  const networkTypeDetail = ref<Required<AddOrUpdateNetworkTypeFrom> | null>(null)
  const getNetworkTypeDetailLoading = ref(false)

  const getNetworkTypeDetail = async (typeId: string) => {
    getNetworkTypeDetailLoading.value = true
    const res = await getTypeDetail(typeId)
    getNetworkTypeDetailLoading.value = false
    networkTypeDetail.value = res.data.data.row
  }

  return {
    networkTypeDetail,
    getNetworkTypeDetailLoading,
    getNetworkTypeDetail,
  }
}

export default useGetNetworkTypeDetail
